package com.zxy.supplier_system.server.entity

import jakarta.persistence.*
import java.io.Serializable
import java.time.OffsetDateTime

@Entity
@IdClass(JwtTokenMetadata.UnionId::class)
class JwtTokenMetadata {

    data class UnionId(
        var user:Int = 0,
        var client:Client = Client.APP,
    ):Serializable

    @ManyToOne
    @JoinColumn
    @Id
    lateinit var user: Employee

    enum class Client {
        APP,
        WEB_ADMIN,
        MINI_PROGRAM,
    }

    @Id
    @Enumerated(EnumType.ORDINAL)
    lateinit var client: Client

    lateinit var lastLogInDateTime: OffsetDateTime

    var lastLogOutDateTime: OffsetDateTime? = null

    var lastRefreshDateTime: OffsetDateTime? = null

}